package network;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class UdpDictServer extends UdpEchoServer {
    private Map<String, String> map = new HashMap<>();
    public UdpDictServer(int port) throws SocketException {
        super(port);
        map.put("hello", "你好");
        map.put("banana", "香蕉");
    }

    @Override
    public String process(String request) {
        return map.getOrDefault(request, "没查到");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer udpDictServer = new UdpDictServer(3030);
        udpDictServer.start();
    }
}
